#!/bin/sh
#获取当前日期
nt=`date "+%Y-%m-%d"`
# 使用hive -e 命令执行sql
# 根据当前日期统计当天活跃用户数量
/opt/lagou/servers/hive-2.3.7/bin/hive -e "use azkaban_test;
insert into table user_info select count(DISTINCT id) activenum,
TO_DATE(click_time) time  FROM user_clicks WHERE TO_DATE(click_time) = '$nt' GROUP BY TO_DATE(click_time);"
# 打印执行的命令
echo "use azkaban;
insert into table user_info select count(DISTINCT id) activenum,
TO_DATE(click_time) time  FROM user_clicks WHERE TO_DATE(click_time) = '$nt' GROUP BY TO_DATE(click_time);"

